package com.hobobe.tiercel.test;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.alibaba.fastjson.JSON;
public class FastJsonC {
	public static void main(String[] args) {

		long l = System.currentTimeMillis();
		Person p = new Person();
		Student s = new Student();
		Teacher t = new Teacher();

		s.setAge(12);
		s.setId(1);
		s.setName("foreveross");

		t.setId(23);
		t.setAge(14);
		t.setName("foreveross");

		p.setStudent(s);
		p.setTeacher(t);

		String x = JSON.toJSONString(p);
		System.out.println(x); //类


		List<Student> list = new ArrayList<Student>();
		list.add(s);
		String ls = JSON.toJSONString(list); //打印List
		System.out.println(ls);

		Map<String,Object> map = new HashMap<String,Object>();
		map.put("person", p);
		map.put("teacher", t);
		String mp = JSON.toJSONString(map); //打印Map
		System.out.println(mp);

		long l1 = System.currentTimeMillis();

		System.out.print(l1-l);
		System.out.println("ms");


		}

}
